package app.game.common;

import puri01.game.GameControl;
import puri01.game.GameControlGroup;
import app.game.resource.ResourceSound;

public class Lasers extends GameControl {

	private static final int _FIRE_INTERVAL = 250;

	public Lasers(GameControlGroup gameControlGroup) {
		super(gameControlGroup);

	}
	
	private long _OldTick = 0;
	
	public void Fire(int x, int y) {
		long tick = System.currentTimeMillis();

		if ((_OldTick == 0) || ((tick-_OldTick) >= _FIRE_INTERVAL)) {
			Laser laser = new Laser(null);
			laser.Init(x, y);
			this.getGameControlGroup().addControl(laser);
			
			ResourceSound.getInstance().fire();
			
			_OldTick = tick;
		}
	}

}
